package cn.com.zcode.dic.jstl;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import cn.com.zcode.dic.control.ApplicationCache;
import cn.com.zcode.dic.model.Dictionary;


public class DictionaryUtil {
	public static String title(String code) {
		Dictionary dic = ApplicationCache.getDictionaryByCode(code);
		return dic == null ? null : dic.getTitle();
	}
	public static Map<String, String> type(String type) {
		List<Dictionary> list = ApplicationCache.getDictionaryByType(type);
		Map<String, String> map = new LinkedHashMap<String, String>();
		if (list != null) {
			for (Dictionary dictionary : list) {
				map.put(dictionary.getCode(), dictionary.getTitle());
			}
		}
		return map;
	}

}
